<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>申请单</title>
		<script type="text/javascript">
			function myApply(){
				var showApply = document.getElementById("applyId");
				showApply.style.display="inline";
			}
		</script>
	</head>
	<body>
		<table border="1">
			<tr>
				<th colspan="5">${user.username }的申请单</th>
			</tr>
			<tr>
				<td>金额</td>
				<td>原因</td>
				<td>状态</td>
				<td>当前审批位置</td>
				<td>申请时间</td>
			</tr>
			<c:forEach items="${list}" var="apply">
				<tr>
					<td>${apply.salary }</td>
					<td>${apply.description }</td>
					<td>
						<c:if test="${apply.state=='0' }">审批中</c:if>
						<c:if test="${apply.state=='1' }">已批准</c:if>
						<c:if test="${apply.state=='2' }">为批准</c:if>
					</td>
					<td>
						<c:if test="${apply.flag=='0' }">部门主管</c:if>
						<c:if test="${apply.flag=='1' }">经理</c:if>
						<c:if test="${apply.flag=='2' }">老板</c:if>
						<c:if test="${apply.flag=='3' }">${user.username }</c:if>
					</td>
					<td>${apply.startTime }</td>
				</tr>
			</c:forEach>
		</table>
		<p>=============================================华丽的分割线================================================</p>
		<a href="javascript:myApply();">申请</a>
		<div id="applyId" style="display: none">
			<form action="applyAction!submitApply.action" method="post">
				申请金额：<input type="text" name="apply.salary"/><br/>
				申请理由：<br/>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<textarea rows="10" cols="20" name="apply.description"></textarea>
				<input type="submit" value="提交"/>
			</form>
		</div>
		<a href="userAction!logout.action">登出</a>
	</body>
</html>